#include "manager.h"
#include <iostream>
#include<fstream>
#include<ctime>

//#define ALLOCATOR

class Element
{
    long n1;
    long n2;
    long n3;
    long n4;
    long n5;
    long n6;
    long n7;
    long n8;
public:
    void foo()
    { 
        n1=n2=n3=n4=n5=n6=n7=n8=42;
    };
};

int main()
{
    std::ofstream log("log.txt", std::ios::app);
    clock_t t = clock();
#ifdef ALLOCATOR
    Manager m;
#endif
    long i;
    for(i=0;i<10000000;++i)
    {
        //try{
#ifdef ALLOCATOR
            Element* el = static_cast<Element*>(m.allocate());
#else
            Element* el = new Element;
#endif
            el->foo();
        //}
        //catch(...) { 
        //    std::cout<<i;
        //    std::cin.get();
        //}
    }
    t = clock() - t;
    log << "size: " << i << " time: " << t << " ticks / " << ((float)t)/CLOCKS_PER_SEC << " s." << std::endl;
    return 0;
}

